import Vue from 'vue'
import VueRouter from 'vue-router'
const Home=()=>import('../views/home/Home') 
const Type=()=>import('../views/type/Type') 
const Mine=()=>import('../views/mine/Mine') 
const Shopping=()=>import('../views/shopping/Shopping') 
const Detail=()=>import('../views/detail/Detail') 
//1、安装插件
Vue.use(VueRouter)
//2、创建router
const routes= [
    {
      path: '/',
      redirect: '/home',
      meta: {keepAlive: true}   // 设置页面缓存，保持tab状态
    },
    {
      path: '/home',
      component: Home,
      meta: {keepAlive: true}   // 设置页面缓存，保持tab状态
    },
    {
      path: '/type',
      component: Type,
      meta: {keepAlive: true}   // 设置页面缓存，保持tab状态
    },
    {
      path: '/mine',
      component: Mine,
      meta: {keepAlive: true}   // 设置页面缓存，保持tab状态
    },
    {
      path: '/shopping',
      component: Shopping,
      meta: {keepAlive: true}   // 设置页面缓存，保持tab状态
    },
    {
      path: '/detail/:id',
      component: Detail,
      // meta: {keepAlive: true}   // 设置页面缓存，保持tab状态
    }
  ]
const router=new VueRouter({
    routes,
    mode:'history'
})
export default router